﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MethodWorx.CMS.Plugins
{
    [Serializable]
    public class HtmlPropertyDetails : ICustomPropertyDetails
    {
        public bool Bold { get; set; }
        public bool Italic { get; set; }
        public bool Underline { get; set; }
        public bool Styles { get; set; }
        public bool Image { get; set; }
        public bool Link { get; set; }
        public string Value { get; set; }
        public bool Heading1 { get; set; }
        public bool Heading2 { get; set; }
        public bool Heading3 { get; set; }
        public bool Heading4 { get; set; }
        public bool Heading5 { get; set; }
        public bool Heading6 { get; set; }
        public bool Paragraph { get; set; }
        public bool Div { get; set; }
        public bool OrderedList { get; set; }
        public bool UnorderedList { get; set; }

        public void CopyValueFrom(ICustomPropertyDetails from)
        {
            this.Value = ((HtmlPropertyDetails)from).Value;
        }

        

        public override string ToString()
        {
            string value = this.Value;
            if (value.StartsWith("<content>"))
                value = value.Substring(9);
            if (value.EndsWith("</content>"))
                value = value.Remove(value.Length - 10);
            return value;
        }

        #region ICustomPropertyDetails Members


        public void Parse(string input)
        {
            this.Value = input;
        }

        #endregion



        public object Clone()
        {
            return this.MemberwiseClone();
        }


        public bool IsNull()
        {
            return this.Value == null;
        }

        public bool IsEmpty()
        {
            return this.Value == "" || this.Value == "<content></content>";
        }


    }
}
